import os
import sys
sys.path.append('.')

from app import process_file_by_type, calculate_workload_stats

# 测试文件路径
workload_file = 'uploads/workload/1755001789.6565225.xls'

if os.path.exists(workload_file):
    print("🧪 开始验证修复...")
    
    # 处理工作量文件
    result = process_file_by_type(workload_file, 'workload')
    print(f"✅ 处理了 {result} 条记录")
    
    # 从app.py导入数据
    from app import workload_data
    print(f"📊 工作量数据: {len(workload_data)} 条")
    
    # 显示前3条数据
    for i, record in enumerate(workload_data[:3]):
        print(f"记录{i+1}: 总工时={record.get('总工时', 'N/A')}, 排期工时={record.get('排期工时', 'N/A')}")
    
    # 计算统计
    stats = calculate_workload_stats('2024-01-01', '2025-12-31')
    print(f"\n📈 统计结果: {len(stats)} 条")
    for stat in stats[:3]:
        print(f"用户: {stat['user_name']}, 总工时: {stat['total_hours']}, 饱和度: {stat['saturation']}%")
        
else:
    print("❌ 工作量文件不存在")